package com.example.demo;

import com.example.config.WebSocketServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RequestMapping
@RestController
public class TestController {

@Autowired
private WebSocketServer webSocketServer;
    @GetMapping("sendMessage")
    public void sendMessage(){
        ArrayList<String> strings = new ArrayList<>();
        strings.add("1");
        strings.add("2");
        webSocketServer.sendMessage("你好",strings);
    }

    @GetMapping("sendMessage2")
    public void sendMessage1(){
        ArrayList<String> strings = new ArrayList<>();
        strings.add("1");
        webSocketServer.sendMessage("你好",strings);
    }
}
